﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Serilog;
using SuperSocket;
using SuperSocket.Command;
using SuperSocket.ProtoBase;

namespace Lawn.AppServer
{
    class Program
    {
    // 0100090005746f706963000026   register
  
   // 00000b0005746f7069630002010126  pub
        static async Task Main(string[] args)
        {
            // var config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
            //
            // Log.Logger = new LoggerConfiguration().Enrich.FromLogContext().ReadFrom.Configuration(config).CreateLogger();
            //
            //
         
             
            
            
            
                var host = CreateHostBuilder(args).Build();
                await host.RunAsync();
 
            

        }
        
        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureServices((hostBuilderContext, serviceCollection)
                    => new StartUp(hostBuilderContext.Configuration)
                        .ConfigureServices(serviceCollection)).UseSocket().UseInProcSessionContainer().UseSerilog(((context, configuration) =>
                {
                    configuration.ReadFrom.Configuration(context.Configuration);
                    configuration.Enrich.FromLogContext();
                } ));
    }
}